
<?php
$defaultNamespace = new Zend_Session_Namespace('Default');
$config = Vnf::getConfigs('conf');
$shoponline = @$config->shoponline;
$allCategory = $this->allCategory;
$catID = $this->catID;
$avg = $this->avg;
$cat = new Category();
if ($this->itemid > 0) {
    $product = $this->rsItem;
?>
    <div>
        <div style="padding:5px;border:1px solid #000;">
        <?php
        if ($catID > 0) {
            @$allParent = $allCategory[$catID]['all_parent'];
            $arrParent = explode(',', $allParent);
            
            $first = true;
            $cat_id = 0;
            foreach($arrParent as $parent_id):
                @$parent = $allCategory[$parent_id];
                if ($parent['left'] != 1) {
            ?>
                <a href="<?php echo $cat->url($parent)?>"><?php echo $parent['admin_title']?></a> &raquo;
            <?php
                    if ($first) {
                        $cat_id = $parent['category_id'];
                        $first = false;
                    }
                }
            endforeach;
            if ($first) {
                $cat_id = $catID;
            }
            
            @$currentCat = $allCategory[$catID];
            ?>
            <a href="<?php echo $cat->url($currentCat)?>"><?php echo $currentCat['admin_title']?></a> &raquo;
            <?php
        } // cat
            echo $product->Product;
        ?>

        </div>
        <div style="padding-top:10px">
        </div>
        <table width="100%">
            <tr valign="top">
                <td width="220">
                	<? 
                         $productimage = $product->Thumbnail;
                          if (stripos($productimage, 'http') === false) {
                                $productimage = BASE_PATH . $productimage;
                            } else {
                                //echo $image = BASE_PATH . $image;
                                // do nothing
                            }
                         if(count($productimage) > 0) 
                         ?>
                    <a class="grouped_elements" rel="group2" href="<?php echo htmlspecialchars($productimage)?>"><img style="" alt="Clayton Shagal Collagen Gel II 50ml" src="<?php echo htmlspecialchars($productimage)?>" style="max-width:195;max-height:298px;"/></a>    
                </td>
                <td>
                    <div>
                    <h2 style="font-size: 24px;" class="pink"><?php echo $product->Product;?></h2>
                    </div><br />
                    <div>
                    <?php
                        $countview = $this->countreview;
                    ?>
<?php
if ($avg > 0) {
?>
                        
                         <div id="rating"></div><a style="color: gray;" href="<?=BASE_URL?>/shop/reviewlist?id=<?php echo $product->ProductNo ?>"><?php echo ($countview); ?> Reviews</a>
<?php
}
?>                        <?php
                            //endforeach;
                            //}
                         ?>
                    </div>
                    <div>
                        <strong style="font-size: 20px; margin-bottom: 15px; display: block;">Free <span style="font-weight:normal;color:#777777 !important">Shipping</span></strong>
                    </div>
                    <?php 
                    $allAttr = $this->allAttr;
                    if(count($allAttr) > 0) {
                    ?>
                    <div class="pink" style="padding:10px 0px;height:50px;overflow:auto;font-weight:bold;margin:0px 10px 10px 0px">
                        <?php
                        $values = array();
                        foreach($allAttr as $att):
                            $values[$att->Attribute1] = $att->Attribute1;
                        ?>
                            <span style="color:red">$<?php echo $att->Price;?></span> &nbsp;&nbsp;&nbsp; <?=$att->Attribute1?><br>
                        <?php
                        endforeach;
                        ?>
                    </div>
                    <?php
                    if (($product->AuthReq == "Yes") && (!$defaultNamespace->access) ) {
                    ?>
                        <div class="detailPriceTitle" style="font-size:14px;font-weight:bold;">

<div onmouseover="this.getElementsByTagName('div')[0].style.display = 'block';" onmouseout="this.getElementsByTagName('div')[0].style.display = 'none';" style="display:block;position:relative;">

<a href="javascript:;" style="font-style:italicize;z-index:1;">Price N/A - Authorization Required</a>

<div style="border:1px solid #000;background-color:#c6c6c6;width:350px;position:absolute;top:0;left:0;padding:5px;display:none;z-index:10;">

This product requires authorization to view pricing and purchase online.<br/>

Please <a href='<?=BASE_URL?>/index/user/register'>Register/Sign In</a> to purchase.

</div>

</div>

</div>
                    <?php
                    } else {
                    ?>
                        <div class="quantity" >
                            <h2>Please select options:</h2>
                            <br>
                            <?php echo $product->Attribute1Label;?>
                            <?php
                            echo $this->formSelect('optionattr', null, array('align' => 'center'), $values);
                            ?>
                        </div>
                        <div class="pink" style="padding:2px">
                            
                        </div>
                        <div>
                            <div style="" class="quantity">
                            Quantity: <input type="text" size="3" value="1" id="qty" name="qty"/>
                            <input type="button" value="Add To Cart" onclick="javascript:addToCartDetail(<?php echo $product->ProductNo;?>)">
                            </div>
                        </div>
                    <?php
                    }
                    ?>
                    <?php
                    } else {
                        if (($product->AuthReq == "Yes") && (!$defaultNamespace->access) ) {
                    ?>
                        <div class="detailPriceTitle" style="font-size:14px;font-weight:bold;">

<div onmouseover="this.getElementsByTagName('div')[0].style.display = 'block';" onmouseout="this.getElementsByTagName('div')[0].style.display = 'none';" style="display:block;position:relative;">

<a href="javascript:;" style="font-style:italicize;z-index:1;">Price N/A - Authorization Required</a>

<div style="border:1px solid #000;background-color:#c6c6c6;width:350px;position:absolute;top:0;left:0;padding:5px;display:none;z-index:10;">

This product requires authorization to view pricing and purchase online.<br/>

Please <a href='<?=BASE_URL?>/index/user/register'>Register/Sign In</a> to purchase.

</div>

</div>

</div>
                    <?php
                        } else { // no need author
                        ?>
                        <div style="padding:10px 0px 5px 0px;font-weight:bold; color:#777; font-weight: bold;">
                            <?php
                            if($product->ShowPriceYN  == "Yes")
                            {
                                $lineThrough = '';
                                $salePrice = '';
                                if ($product->PriceRetail && $product->PriceRetail > 0) {
                                    $lineThrough = ' style="text-decoration: line-through;"';
                                    $salePrice = '<strong style="color:red">$' . $product->PriceRetail . '</strong>';
                                }
                                     //echo "Price: <strong style='text-decoration: line-through;'>$".$product->Price. "</strong> &nbsp; <strong style='color:red'>". $product->PriceRetail."</strong>";
                             ?>
            <div>
                    Price - <strong <?php echo $lineThrough;?>>$<?php echo $product->Price?></strong>&nbsp; 
                    <?php echo $salePrice;?>
            </div>
                                </div>
                                <div>
                                <?php
                                if($product->AddToCartYN == 'Yes' )
                                {
                                ?>
                                    <div style="" class="quantity">
                                    Quantity: <input type="text" size="3" value="1" id="qty" name="qty"/>
                                    <input type="button" value="Add To Cart" onclick="javascript:addToCartDetail(<?php echo $product->ProductNo;?>)">
                                    </div>
                                </div>
                                 <?php
                                }
                            }
                        }
                    }
                    ?>
                    <br />
                    <div>
                         <strong><a style="font-size: 15px; color:#E33588; font-weight: bold;" href="<?php echo BASE_URL?>/shop/addreview?id=<?php echo $product->ProductNo; ?>"><img src="<?php echo JS_PATH?>/skincarebyalana/images/review_icon.jpg" /> Write a review for product</a></strong>
                    </div>
                </td>
                <?php
                if ((@$allCategory[$cat_id])) {
                ?>
                <td id="splashRight">
                    <?php
                    
                    
                    if($product->ExtText1) {
                        $video = trim($product->ExtText1);
                    } else {
                        $config = $config = Vnf::getConfigs('conf');
                        $video = $config->defaultProductVideo;
                    }                                            
                    ?>
                    <a href="<?php echo $video;?>" class="media"></a>
                </td>
                <?php
                }
                ?>
            </tr>
            <tr>
                <td colspan="3">
                      <?php
                        $values = array();
                        $productimage = $this->imageproduct;
                        foreach($productimage as $productimg):
                            $values[$productimg->ProductImage] = $productimg->ProductImage;
                            $productimg = $productimg->ProductImage;
                            if (stripos($productimg, 'http') === false) {
                                $productimg = BASE_PATH . $productimg;
                            } else {
                                //echo $image = BASE_PATH . $image;
                                // do nothing
                            }
                        ?>
                        <span>
                            <a class="grouped_elements" rel="group2" href="<?php echo htmlspecialchars($productimg)?>"><img style="width:50px; height:50px; padding: 2px; margin:5px; border: 1px solid black;" alt="Clayton Shagal Collagen Gel II 50ml" src="<?php echo htmlspecialchars($productimg)?>"/></a>
                        </span>
                         <?
                                  endforeach; 
                            ?>
                </td>
            </tr>
            
        </table><br />
        
        
        <div id="featuredCat">
            <div id="pinkBox" style="float: left;"><span style="font-size: 17px;" class="white">Detailed Description</span></div>
        </div>
        <div id="productDescription">
            <?php echo $product->Description;?>
            <br/>
            <h3 class="black">Specifications</h3>
            <p>ProductNo: <strong><?php echo $product->ProductNo;?></strong></p>
            <p>Manufacturer: <strong><?php echo $product->Oem;?></strong></p>
            <p>SKU: <strong><?php echo $product->SKU;?></strong></p>
        </div>
        <div id="productRelative">
            <table width="100%">
                <tr>
                    <td>
                    	<? 
                         $relativeproduct = $this->relative;
                         //echo count($relativeproduct);
                         if(count($relativeproduct) > 0)
                         {
                         ?>
                         <hr/>
                         <fieldset style="border:1px solid #cccccc;padding-left:10px;padding-bottom:0px;">
                            <legend>
                            <b>" Alana recommends these products to work with <?php echo $currentCat['admin_title']; ?> </b>
                            </legend>
                            <div style="padding: 5px;"></div>
                            
                            
                            <div style="width: 100%;">
                                <?
                                    if (isset($relativeproduct[0])) {
                                    $i = 0;
                                    $itemPerRow = 4;
                                    $widthPercent = 100/$itemPerRow - 3;
                                ?>
                                
                                <?
                                    $values = array();
                                    foreach($relativeproduct as $relative):
                                        $values[$relative->RelativePhoto] = $relative->RelativePhoto;
                                        $RelativePhoto = $relative->RelativePhoto;
                                                if (stripos($RelativePhoto, 'http') === false) {
                                            $RelativePhoto = BASE_PATH . $RelativePhoto;
                                        } else {
                                            //echo $image = BASE_PATH . $image;
                                            // do nothing
                                        }
                        ?>              
                                        <div style="width: <?php echo $widthPercent;?>%; float:left;">
                                        
                                        <div style="margin-bottom: 20px;" align="center">
                                            <a href="<?php echo BASE_URL ?>/index/shop/detail?id=<?php echo $relative->RelativeProductNo; ?>"><?php echo $relative->RelativeProduct; ?></a>
                                            <br />
                                            <a href="<?php echo BASE_URL ?>/index/shop/detail?id=<?php echo $relative->RelativeProductNo; ?>"><img style=" width:60px; height:80px;" alt="Clayton Shagal Collagen Gel II 50ml" src="<?php echo htmlspecialchars($RelativePhoto)?>"/></a>
                                            <br />
                            <?php
                                if(@$relative->ShowPriceYN  == "Yes")
                                 {
                            ?>
                                            <p>Price - <b style="color: red;">$<?php echo $relative->priceproduct; ?></b></p> 
                            <?php
                                }
                            ?>
                                        </div>
                                        <div style="padding-bottom:20px" align="center">
                    <a title="<?php echo htmlspecialchars($relative->RelativeProduct); ?>" class="thumbnail" href="<?php echo BASE_URL ?>/index/shop/detail?id=<?php echo $relative->ProductNo; ?>"><img alt="More Info" src="<?php echo JS_PATH?>/skincarebyalana/images/moreInfo.png"/></a>
                    <?php 
                    if ($relative->priceproduct) { // just show buy button if price enter in admin 
                        if ($relative->AuthReq != "Yes") { // add login later
                        if(@$relative->AddToCartYN == 'Yes' )
                        {
                        ?>
                            
                                <img alt="More Info" src="<?php echo JS_PATH?>/skincarebyalana/images/buyit.gif" rel="<?php echo $relative->ProductNo; ?>" class="buynow">
                            
                        <?php
                        }
                        } // if AuthReq
                    }
                    ?>
                </div>
                                      <div style=" clear: both;"></div>  
                                     
                                       
                                    </div>
                                     
                                        <?
                                  endforeach; 
                            ?>
                                    <? } ?>
                                
                                
                            </div> 
                            
                        </fieldset>
                        
                        <hr/>
                        <? }?>
                    </td>
                </tr>
            </table>
        </div>
       
    </div>
     <div style="margin-top: 10px;">
            <a style="font-size: 13pt;"  href="<?=BASE_URL?>/shop/reviewlist?id=<?php echo $product->ProductNo ?>" title="testimonial"><input type="submit" value="See All Reviews for this product" class="uniform" /></a>
        </div>
<?php
} // if item
?>
<style>
#productDescription img {
max-width:745px;
}
</style>
<script type="text/javascript" src="<?php echo JS_PATH ?>/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" href="<?php echo JS_PATH ?>/jquery/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script type="text/javascript" language="javascript" >
    $(document).ready(function() {
        $("a.grouped_elements").fancybox({
            'transitionIn'	:	'elastic',
            'transitionOut'	:	'elastic',
            'speedIn'		:	600, 
            'speedOut'		:	200, 
            'overlayShow'	:	false
        });
    });
</script>

<script type="text/javascript" src="<?=JS_PATH?>/jquery/media/jquery.media.js"></script> 
<!--script type="text/javascript" src="<?=JS_PATH?>/jquery/jquery.metadata.js"></script--> 
<!--script type="text/javascript" src="http://github.com/malsup/media/raw/master/jquery.media.js?v0.92"></script-->
<script type="text/javascript">
    $(function() {
        $.fn.media.defaults.flvPlayer = '<?=JS_PATH?>/jquery/media/mediaplayer.swf';
        $.fn.media.defaults.mp3Player = '<?=JS_PATH?>/jquery/media/mediaplayer.swf';
        $('a.media').media( { width: 250, height: 187, type:'swf' } );
    });
</script>


<?php
if ($avg > 0) {
?>
<script src="<?php echo JS_PATH?>/jquery/jquery.raty-1.3.2/js/jquery.raty.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8"> 
$(function(){
    $('#rating').raty({
        path: '<?php echo JS_PATH?>/jquery/jquery.raty-1.3.2/img/',
        noRatedMsg: 'No body review this product',
        start: '<?php echo $avg ?>',
        readOnly:  true,
        half:       true
    });
});
</script>  

<?php
}
?>